/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package formularios;

import Clases.*;
import de.javasoft.swing.JYTable;
import de.javasoft.swing.JYTableHeader;
import de.javasoft.swing.JYTableScrollPane;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.sql.ResultSet;
import java.util.Date;

import java.util.Hashtable;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;

/**
 *
 * @author Jrg
 */
public class catalogoAlumnos extends javax.swing.JInternalFrame {
    
    public static int IdMenu=1;
    ModeloTabla _modeloTabla;
    JYTable _tabla;
    int _idAlumno;

    /**
     * Creates new form calalogoAlumnos
     */
    public catalogoAlumnos() 
    {
        initComponents();
        CrearModeloTabla();
        CargarComboGrado();
        CargarComboPadre();
        CargarComboMadre();
        CargarTabla();
        ObtenerFechaActual();
    }
    
    private void ObtenerFechaActual()
    {
        jDateFechaNac.setDate(Transacciones.ObtenerFechaServidor(MainMenu.conexion));

    }
    private void CrearModeloTabla()
    {
        try
        {
        /*columnas que no son editables*/
        Hashtable colReadOnly= new Hashtable();
        colReadOnly.clear();
        colReadOnly.put(0, 0); //IdAlumno
        colReadOnly.put(1, 75); //No Carnet
        colReadOnly.put(2, 250); //Nombre
        colReadOnly.put(3, 150); //Grado
        colReadOnly.put(4, 250); //Padre
        colReadOnly.put(5, 250); //Madre
        colReadOnly.put(6, 300); //Direccion
        colReadOnly.put(7, 0); //Telefono
        colReadOnly.put(8, 0); //Email
        colReadOnly.put(9, 0); //fecha nacimiento
        colReadOnly.put(10, 0); //idgrado
        colReadOnly.put(11, 0); //idpadre
        colReadOnly.put(12, 0); //idmadre
        colReadOnly.put(13, 0); //Colegiatura
        colReadOnly.put(14, 0); //Ingles
        colReadOnly.put(15, 0); //Intecap
        colReadOnly.put(16, 0); //telefono padre
        colReadOnly.put(17, 0); //telefono madre
        colReadOnly.put(18, 0); //telefono emergencia
        colReadOnly.put(19, 0); //telefono otro
        colReadOnly.put(20, 0); //Observaciones
        String[] columnNames = {"IdAlumno","No. Carnet","Nombre","Grado","Padre","Madre","Direccion","Telefono","Email","Fecha Nacimiento","idgrado","idpadre","idmadre","Colegiatura","Ingles","Intecap","telPadre","telMadre","telEmergencia","telOtro","Observaciones"};
        final Class<?>[] columnClasses = {Integer.class,String.class, String.class, String.class, String.class, String.class,String.class,String.class,String.class,Date.class,Integer.class,Integer.class,Integer.class,Double.class,Double.class,Double.class,String.class, String.class, String.class, String.class,String.class}; 
        _modeloTabla = new ModeloTabla(colReadOnly);
        _modeloTabla.setColumnIdentifiers(columnNames);
        _modeloTabla.RemoveAllRows();
        _tabla = new JYTable(_modeloTabla)
        {
            @Override
            public Class<?> getColumnClass(int columnIndex)
            {
                return columnClasses[columnIndex];
            }
         };
        _tabla.addMouseListener(new MouseListener() 
        {
            public void mouseClicked(MouseEvent me) 
            {
                CargarFicha();
            }
            public void mousePressed(MouseEvent me) 
            {
                return;
            }

            public void mouseReleased(MouseEvent me) 
            {
                return;
            }

            public void mouseEntered(MouseEvent me) 
            {
                return;
            }

            public void mouseExited(MouseEvent me) 
            {
                return;
            }
        });
        
        _tabla.addKeyListener(new KeyListener() {

            public void keyTyped(KeyEvent ke) {
               return;// CargarFicha();
            }

            public void keyPressed(KeyEvent ke) {
                return;//CargarFicha();
            }

            public void keyReleased(KeyEvent ke) {
                CargarFicha();
            }
            
            public void keyEnter(KeyEvent ke){
//                CargarFicha();
            }
         });
  
        

        
        JYTableHeader header =  (JYTableHeader)_tabla.getTableHeader();
        JYTableScrollPane scrollPane = new JYTableScrollPane(_tabla);
        AnchoColumna ac = new AnchoColumna(_tabla,colReadOnly);
//        OcultarColumnas oc = new OcultarColumnas(_tabla,0);
       
        panelTabla.setVisible(false);
        panelTabla.add(scrollPane);
        panelTabla.setVisible(true);
        }
        catch(Exception ex)
        {
            
        }
    }
    
    private void CargarTabla()
    {
        try
        {
            _modeloTabla.RemoveAllRows();
            ResultSet rs = MainMenu.conexion.EjecutarConsulta("select a.idalumno, a.nocarnet,  a.nombre, g.nombre grado, p.nombre padre ,"+
                        "m.nombre madre, a.direccion, a.telefonos, a.email, a.fechanacimiento, "+
                        "g.idgrado , p.identidad idpadre, m.identidad idmadre, a.colegiatura, a.ingles, a.intecap, "+
                        "a.telefonopapa, a.telefonomama, telefonoemergencia, a.telefonootro, a.observaciones from alumnos a left join entidades p on a.idpadre=p.identidad "+
                        "left join entidades m on a.idmadre=m.identidad left join grados g on a.idgrado=g.idgrado "+
                        "where a.debaja is null order by a.nombre asc");
            while (rs.next())
            {
                Vector alumno = new Vector();
                alumno.addElement(rs.getInt("idalumno"));//0
                alumno.addElement(rs.getString("nocarnet"));//1
                alumno.addElement(rs.getString("nombre"));//2
                alumno.addElement(rs.getString("grado"));//3
                alumno.addElement(rs.getString("padre"));//4
                alumno.addElement(rs.getString("madre"));//5
                alumno.addElement(rs.getString("direccion"));//6
                alumno.addElement(rs.getString("telefonos"));//7
                alumno.addElement(rs.getString("email"));//8
                alumno.addElement(rs.getDate("fechanacimiento"));//9
                alumno.addElement(rs.getInt("idgrado"));//10
                alumno.addElement(rs.getInt("idpadre"));//11
                alumno.addElement(rs.getInt("idmadre"));//12
                alumno.addElement(rs.getDouble("colegiatura"));//13
                alumno.addElement(rs.getDouble("ingles"));//14
                alumno.addElement(rs.getDouble("intecap"));//15
                alumno.addElement(rs.getString("telefonopapa"));//16
                alumno.addElement(rs.getString("telefonomama"));//17
                alumno.addElement(rs.getString("telefonoemergencia"));//18
                alumno.addElement(rs.getString("telefonootro"));//19
                alumno.addElement(rs.getString("observaciones"));//20
                _modeloTabla.addRow(alumno);
            }
        }
        catch(Exception ex)
        {
            
        }
        finally
        {
            MainMenu.conexion.CerrarConexion();
        }
    }
    
    private void CargarComboGrado()
    {
        DefaultComboBoxModel modelo = Clases.ComboBox.CargarCombo("select idgrado id, nombre from grados where debaja is null order by idgrado", MainMenu.conexion);
        cbGrado.setModel(modelo);
        AutoCompleteDecorator.decorate(cbGrado);
    }
    
    private void CargarComboPadre()
    {
        DefaultComboBoxModel modelo = Clases.ComboBox.CargarCombo("select identidad id, nombre from entidades where debaja is null and idtipoentidad=1 order by nombre asc", MainMenu.conexion);
        cbPadre.setModel(modelo);
        AutoCompleteDecorator.decorate(cbPadre);
    }
    
    private void CargarComboMadre()
    {
        DefaultComboBoxModel modelo = Clases.ComboBox.CargarCombo("select identidad id, nombre from entidades where debaja is null and idtipoentidad=2 order by nombre asc", MainMenu.conexion);
        cbMadre.setModel(modelo);
        AutoCompleteDecorator.decorate(cbMadre);
    }
    
    private void CargarFicha()
    {
        try
        {
            LimpiarVariables();//para limpiar los text fields
            int selectedRow = _tabla.getSelectedRow();
            _idAlumno =(Integer)_tabla.getValueAt(selectedRow, 0);
            
            if(_tabla.getValueAt(selectedRow, 10)!=null &&_tabla.getValueAt(selectedRow, 3)!=null)
            {
                ComboBox grado = new ComboBox((Integer)_tabla.getValueAt(selectedRow, 10),_tabla.getValueAt(selectedRow, 3).toString());
                cbGrado.getModel().setSelectedItem(grado);
            }
            if(_tabla.getValueAt(selectedRow, 11)!=null &&_tabla.getValueAt(selectedRow, 4)!=null)
            {
                ComboBox padre = new ComboBox((Integer)_tabla.getValueAt(selectedRow, 11),_tabla.getValueAt(selectedRow, 4).toString());
                cbPadre.getModel().setSelectedItem(padre);
            }
            if(_tabla.getValueAt(selectedRow, 12)!=null &&_tabla.getValueAt(selectedRow, 5)!=null)
            {
                ComboBox madre = new ComboBox((Integer)_tabla.getValueAt(selectedRow, 12),_tabla.getValueAt(selectedRow, 5).toString());
                cbMadre.getModel().setSelectedItem(madre);
            }
            if(_tabla.getValueAt(selectedRow, 2)!=null)
                tfNombre.setText(_tabla.getValueAt(selectedRow, 2).toString());
            if (_tabla.getValueAt(selectedRow, 1)!=null)
                tfCarnet.setText(_tabla.getValueAt(selectedRow, 1).toString());
            if (_tabla.getValueAt(selectedRow, 9)!=null)
                jDateFechaNac.setDate((Date)_tabla.getValueAt(selectedRow, 9));
            if (_tabla.getValueAt(selectedRow, 6)!=null)
                tfDireccion.setText(_tabla.getValueAt(selectedRow, 6).toString());
            if (_tabla.getValueAt(selectedRow, 7)!=null)
                tfTelefonoCasa.setText(_tabla.getValueAt(selectedRow, 7).toString());
            if (_tabla.getValueAt(selectedRow, 8)!=null)
                tfEmail.setText(_tabla.getValueAt(selectedRow, 8).toString());
            if (_tabla.getValueAt(selectedRow, 13)!=null)
                tfColegiatura.setText(_tabla.getValueAt(selectedRow, 13).toString());
            if (_tabla.getValueAt(selectedRow, 14)!=null)
                tfIngles.setText(_tabla.getValueAt(selectedRow, 14).toString());
            if (_tabla.getValueAt(selectedRow, 15)!=null)
                tfIntecap.setText(_tabla.getValueAt(selectedRow, 15).toString());
            if (_tabla.getValueAt(selectedRow, 16)!=null)
                tfTelefonosPadre.setText(_tabla.getValueAt(selectedRow, 16).toString());
            if (_tabla.getValueAt(selectedRow, 17)!=null)
                tfTelefonoMadre.setText(_tabla.getValueAt(selectedRow, 17).toString());
            if (_tabla.getValueAt(selectedRow, 18)!=null)
                tfTelefonoEmergencia.setText(_tabla.getValueAt(selectedRow, 18).toString());
            if (_tabla.getValueAt(selectedRow, 19)!=null)
                tfTelefonoOtro.setText(_tabla.getValueAt(selectedRow, 19).toString());
            if (_tabla.getValueAt(selectedRow, 20)!=null)
                tfObservaciones.setText(_tabla.getValueAt(selectedRow, 20).toString());

            
        }
        catch(Exception ex)
        {
            
        }
    }
    
    private void Guardar()
    {
        double colegiatura=0;
        double ingles =0;
        double intecap=0;
        int idpadre = 0;
        int idmadre = 0;
        int idgrado =0;
        
        try{colegiatura=(double)Math.round(Double.valueOf(tfColegiatura.getText())*100)/100;} catch(Exception ex) { }
        try{ingles=(double)Math.round(Double.valueOf(tfIngles.getText())*100)/100;} catch(Exception ex) { }
        try{intecap=(double)Math.round(Double.valueOf(tfIntecap.getText())*100)/100;} catch(Exception ex) { }
        
        try{idpadre = ((ComboBox) cbPadre.getSelectedItem()).getId();} catch(Exception ex) { }
        try{idmadre = ((ComboBox) cbMadre.getSelectedItem()).getId();} catch(Exception ex) { }
        try{idgrado =((ComboBox) cbGrado.getSelectedItem()).getId();} catch(Exception ex) { }
        
        try
        {
            if (idgrado!=0 && idpadre!=0 && idmadre!=0)
            {
                String fechaNac = Clases.Tools.FormatoFechaDB(this.jDateFechaNac.getDate());

                String strComando ="";
                if (_idAlumno==0)
                {
                    strComando="insert into alumnos(nombre,nocarnet,idpadre,idmadre,idgrado,"+
                        "fechanacimiento,direccion,telefonos,email,idusuario,colegiatura,ingles,intecap,"+
                        "telefonopapa, telefonomama, telefonoemergencia, telefonootro,observaciones) "+
                        "values('"+tfNombre.getText()+"','"+tfCarnet.getText()+"',"+idpadre+","+idmadre+","+idgrado+
                        ",'"+fechaNac+"','"+tfDireccion.getText()+"','"+tfTelefonoCasa.getText()+"','"+tfEmail.getText()+"',"+MainMenu.IdUsuario+
                        ","+colegiatura+","+ingles+","+intecap+",'"+tfTelefonosPadre.getText()+"','"+tfTelefonoMadre.getText()+
                        "','"+tfTelefonoEmergencia.getText()+"','"+tfTelefonoOtro.getText()+"','"+tfObservaciones.getText()+"')";
                }
                else
                {
                    strComando="update alumnos set nombre='"+tfNombre.getText()+"',nocarnet='"+tfCarnet.getText()+"'"+
                            ",idpadre="+idpadre+",idmadre="+idmadre+",idgrado="+idgrado+
                            ",fechanacimiento='"+fechaNac+"',direccion='"+tfDireccion.getText()+"'"+
                            ",telefonos='"+tfTelefonoCasa.getText()+"',email='"+tfEmail.getText()+"'"+
                            ",idusuario="+MainMenu.IdUsuario+
                            ",colegiatura="+colegiatura+
                            ",ingles="+ingles+
                            ",intecap="+intecap+
                            ",telefonopapa='"+tfTelefonosPadre.getText()+"'"+
                            ",telefonomama='"+tfTelefonoMadre.getText()+"'"+
                            ",telefonoemergencia='"+tfTelefonoEmergencia.getText()+"'"+
                            ",telefonootro='"+tfTelefonoOtro.getText()+"'"+
                            ",observaciones='"+tfObservaciones.getText()+"' "+
                            " where idalumno="+_idAlumno;
                }
                String resultado="";
                resultado=MainMenu.conexion.Ejecutar(strComando);
                if (resultado.equals(""))
                {
                    JOptionPane.showMessageDialog(this, "Los datos se almacenaron correctamente","Información",JOptionPane.INFORMATION_MESSAGE);
                    LimpiarVariables();
                    CargarTabla();
                }
                else
                    JOptionPane.showMessageDialog(this, resultado,"Error",JOptionPane.ERROR_MESSAGE);
            }
            else
                JOptionPane.showMessageDialog(this,"Debe seleccionar grado, padre y madre","Error",JOptionPane.ERROR_MESSAGE);
        }
        catch(Exception ex)
        {
            
        }
    }
    
    private void LimpiarVariables()
    {
        _idAlumno =0;
        tfNombre.setText("");
        tfCarnet.setText("");
        ObtenerFechaActual();
        tfDireccion.setText("");
        tfTelefonoCasa.setText("");
        tfEmail.setText("");
        cbGrado.setSelectedIndex(0);
        cbPadre.setSelectedIndex(0);
        cbMadre.setSelectedIndex(0);
        tfColegiatura.setText("0.00");
        tfIngles.setText("0.00");
        tfIntecap.setText("0.00");
        tfTelefonosPadre.setText("");
        tfTelefonoMadre.setText("");
        tfTelefonoEmergencia.setText("");
        tfTelefonoOtro.setText("");
        tfObservaciones.setText("");
    }
    
    private void Eliminar()
    {
        try
        {
            if(_idAlumno!=0)
            {
                if(JOptionPane.showConfirmDialog(null, "¿Desea dar de baja el alumno seleccionado?", "Confirme por favor", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)== JOptionPane.YES_OPTION)
                {
                    String resultado="";
                    resultado=MainMenu.conexion.Ejecutar("update alumnos set debaja=now() where idalumno="+_idAlumno);
                    if (resultado.equals(""))
                    {
                        JOptionPane.showMessageDialog(this, "Los datos se almacenaron correctamente","Información",JOptionPane.INFORMATION_MESSAGE);
                        LimpiarVariables();
                        CargarTabla();
                    }
                    else
                        JOptionPane.showMessageDialog(this, resultado,"Error",JOptionPane.ERROR_MESSAGE);
                }
            }
            else
                JOptionPane.showMessageDialog(this, "debe seleccionar un alumno para dar de baja","Error",JOptionPane.INFORMATION_MESSAGE);
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(this, ex,"Error",JOptionPane.ERROR_MESSAGE);
        }
    }
    
    private void AddGrado()
    {
        quickAddGrado d = new quickAddGrado(null, true,"",0);
        d.setVisible(true);  
        if (d._id!=0 && d._nombre!="")
        {
            CargarComboGrado();
            ComboBox grado = new ComboBox(d._id,d._nombre);
            cbGrado.getModel().setSelectedItem(grado);
        }
        d.dispose();
        System.gc();
    }
    
    private void AddPadre()
    {
        quickAddEntidad d = new quickAddEntidad(null, true,1,"Padre",0);
        d.setVisible(true);
        if (d._id!=0 && d._nombre!="")
        {
            CargarComboPadre();
            ComboBox padre = new ComboBox(d._id,d._nombre);
            cbPadre.getModel().setSelectedItem(padre);
        }
        d.dispose();
        System.gc();
    }
    
    private void AddMadre()
    {
        quickAddEntidad d = new quickAddEntidad(null, true,2,"Madre",0);
        d.setVisible(true);
        if (d._id!=0 && d._nombre!="")
        {
            CargarComboMadre();
            ComboBox madre = new ComboBox(d._id,d._nombre);
            cbMadre.getModel().setSelectedItem(madre);
        }
        d.dispose();
        System.gc();
    }
    
    
    private void EditarPadre()
    {
        int idpadre = ((ComboBox) cbPadre.getSelectedItem()).getId();
        String nombre = ((ComboBox) cbPadre.getSelectedItem()).getNombre();
        quickAddEntidad d = new quickAddEntidad(null, true,1,"Padre",idpadre);
        d.setVisible(true);
        if (d._id!=0 && d._nombre!="")
        {
            CargarComboPadre();
            ComboBox padre = new ComboBox(idpadre,nombre);
            cbPadre.getModel().setSelectedItem(padre);
        }
        d.dispose();
        System.gc();
    }
    
    private void EditarMadre()
    {
        int idmadre = ((ComboBox) cbMadre.getSelectedItem()).getId();
        quickAddEntidad d = new quickAddEntidad(null, true,2,"Madre",idmadre);
        d.setVisible(true);
        if (d._id!=0 && d._nombre!="")
        {
            CargarComboMadre();
            ComboBox madre = new ComboBox(d._id,d._nombre);
            cbMadre.getModel().setSelectedItem(madre);
        }
        d.dispose();
        System.gc();
    }
    
    private void EditarGrado()
    {
        ComboBox grado = ((ComboBox) cbGrado.getSelectedItem());
        quickAddGrado d = new quickAddGrado(null, true,grado.getNombre(),grado.getId());
        d.setVisible(true);  
        if (d._id!=0 && d._nombre!="")
        {
            CargarComboGrado();
            ComboBox gradoNew = new ComboBox(d._id,d._nombre);
            cbGrado.getModel().setSelectedItem(gradoNew);
        }
        d.dispose();
        System.gc();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField2 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        panelEditar = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        tfNombre = new javax.swing.JTextField();
        tfCarnet = new javax.swing.JTextField();
        tfDireccion = new javax.swing.JTextField();
        jDateFechaNac = new com.toedter.calendar.JDateChooser();
        jLabel9 = new javax.swing.JLabel();
        tfEmail = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        btnAddGrado = new javax.swing.JButton();
        btnAddGrado1 = new javax.swing.JButton();
        btnAddPadre = new javax.swing.JButton();
        btnAddGrado2 = new javax.swing.JButton();
        btnAddGrado3 = new javax.swing.JButton();
        btnAddMadre = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        cbGrado = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        cbPadre = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        cbMadre = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        tfTelefonoCasa = new javax.swing.JTextField();
        tfTelefonosPadre = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        tfTelefonoMadre = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        tfTelefonoEmergencia = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        tfTelefonoOtro = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tfObservaciones = new javax.swing.JTextArea();
        jPanel6 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        tfColegiatura = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        tfIngles = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        tfIntecap = new javax.swing.JTextField();
        panelTabla = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        btnGuardar = new javax.swing.JButton();
        btnNuevo = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();

        jTextField2.setText("jTextField2");

        jLabel5.setText("jLabel5");

        setClosable(true);
        setMaximizable(true);
        setResizable(true);
        setTitle("Catalogo de Alumnos");
        setToolTipText("");

        jLabel1.setText("Nombre");

        jLabel2.setText("No. Carnet");

        jLabel3.setText("Fecha Nac.");

        jLabel4.setText("E-mail");

        tfCarnet.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfCarnetActionPerformed(evt);
            }
        });

        jLabel9.setText("Dirección");

        btnAddGrado.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/add24.png"))); // NOI18N
        btnAddGrado.setToolTipText("Nuevo");
        btnAddGrado.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        btnAddGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddGradoActionPerformed(evt);
            }
        });

        btnAddGrado1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/edit24.png"))); // NOI18N
        btnAddGrado1.setToolTipText("Editar");
        btnAddGrado1.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        btnAddGrado1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddGrado1ActionPerformed(evt);
            }
        });

        btnAddPadre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/add24.png"))); // NOI18N
        btnAddPadre.setToolTipText("Nuevo");
        btnAddPadre.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        btnAddPadre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddPadreActionPerformed(evt);
            }
        });

        btnAddGrado2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/edit24.png"))); // NOI18N
        btnAddGrado2.setToolTipText("Editar");
        btnAddGrado2.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        btnAddGrado2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddGrado2ActionPerformed(evt);
            }
        });

        btnAddGrado3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/edit24.png"))); // NOI18N
        btnAddGrado3.setToolTipText("Editar");
        btnAddGrado3.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        btnAddGrado3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddGrado3ActionPerformed(evt);
            }
        });

        btnAddMadre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/add24.png"))); // NOI18N
        btnAddMadre.setToolTipText("Nuevo");
        btnAddMadre.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        btnAddMadre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddMadreActionPerformed(evt);
            }
        });

        jLabel8.setText("Grado");

        jLabel6.setText("Padre");

        jLabel7.setText("Madre");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addGap(18, 18, 18)
                                .addComponent(cbGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addComponent(btnAddGrado)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnAddGrado1))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cbMadre, 0, 195, Short.MAX_VALUE)
                            .addComponent(cbPadre, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(btnAddPadre)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnAddGrado2))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addComponent(btnAddMadre)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnAddGrado3)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel8)
                                .addComponent(cbGrado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(btnAddGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnAddGrado1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel6)
                                .addComponent(cbPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(btnAddPadre, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnAddGrado2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(cbMadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnAddMadre, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnAddGrado3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel7))
                .addContainerGap(48, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout panelEditarLayout = new javax.swing.GroupLayout(panelEditar);
        panelEditar.setLayout(panelEditarLayout);
        panelEditarLayout.setHorizontalGroup(
            panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEditarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(panelEditarLayout.createSequentialGroup()
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(26, 26, 26)
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfNombre)
                            .addComponent(jDateFechaNac, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
                            .addComponent(tfEmail, javax.swing.GroupLayout.Alignment.TRAILING)))
                    .addGroup(panelEditarLayout.createSequentialGroup()
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE)
                            .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(26, 26, 26)
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfCarnet)
                            .addComponent(tfDireccion))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(184, Short.MAX_VALUE))
        );
        panelEditarLayout.setVerticalGroup(
            panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEditarLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel3)
                .addGap(57, 57, 57))
            .addGroup(panelEditarLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelEditarLayout.createSequentialGroup()
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                        .addGap(12, 12, 12)
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(tfCarnet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jDateFechaNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(12, 12, 12)
                        .addGroup(panelEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Datos Generales", panelEditar);

        jLabel11.setText("Casa");

        jLabel14.setText("Padre");

        jLabel15.setText("Madre");

        jLabel16.setText("Emergencia");

        jLabel17.setText("Otro");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(22, 22, 22)
                        .addComponent(tfTelefonoMadre))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(22, 22, 22)
                        .addComponent(tfTelefonoCasa, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(22, 22, 22)
                        .addComponent(tfTelefonosPadre)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tfTelefonoOtro, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfTelefonoEmergencia, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 295, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tfTelefonoEmergencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel16))
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tfTelefonoCasa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tfTelefonoOtro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel17))
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tfTelefonosPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfTelefonoMadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addContainerGap(70, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Telefonos", jPanel2);

        tfObservaciones.setColumns(20);
        tfObservaciones.setRows(5);
        jScrollPane1.setViewportView(tfObservaciones);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(410, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Observaciones", jPanel4);

        jLabel10.setText("Colegiatura");

        tfColegiatura.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        tfColegiatura.setText("0.00");
        tfColegiatura.setToolTipText("");

        jLabel12.setText("Ingles");

        tfIngles.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        tfIngles.setText("0.00");

        jLabel13.setText("Intecap");

        tfIntecap.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        tfIntecap.setText("0.00");
        tfIntecap.setToolTipText("");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(83, 83, 83)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(tfIntecap)
                            .addComponent(tfIngles)
                            .addComponent(tfColegiatura, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(83, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(tfColegiatura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(tfIngles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(tfIntecap, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(70, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(593, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Detalle Cobro", jPanel6);

        panelTabla.setLayout(new java.awt.CardLayout());

        btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/floppy24.png"))); // NOI18N
        btnGuardar.setText("Guardar");
        btnGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarActionPerformed(evt);
            }
        });

        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/add24.png"))); // NOI18N
        btnNuevo.setText("Nuevo");
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });

        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete24.png"))); // NOI18N
        btnEliminar.setText("Eliminar");
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnEliminar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnNuevo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnGuardar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnNuevo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnGuardar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnEliminar))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelTabla, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTabbedPane1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(4, 4, 4)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelTabla, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
        Guardar();
    }//GEN-LAST:event_btnGuardarActionPerformed

    private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
       LimpiarVariables();
    }//GEN-LAST:event_btnNuevoActionPerformed

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        Eliminar();
    }//GEN-LAST:event_btnEliminarActionPerformed

    private void tfCarnetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfCarnetActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tfCarnetActionPerformed

    private void btnAddMadreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddMadreActionPerformed
        AddMadre();
    }//GEN-LAST:event_btnAddMadreActionPerformed

    private void btnAddGrado3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddGrado3ActionPerformed
        EditarMadre();
    }//GEN-LAST:event_btnAddGrado3ActionPerformed

    private void btnAddGrado2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddGrado2ActionPerformed
        EditarPadre();
    }//GEN-LAST:event_btnAddGrado2ActionPerformed

    private void btnAddPadreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddPadreActionPerformed
        AddPadre();
    }//GEN-LAST:event_btnAddPadreActionPerformed

    private void btnAddGrado1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddGrado1ActionPerformed
        EditarGrado();
    }//GEN-LAST:event_btnAddGrado1ActionPerformed

    private void btnAddGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddGradoActionPerformed
        AddGrado();
    }//GEN-LAST:event_btnAddGradoActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddGrado;
    private javax.swing.JButton btnAddGrado1;
    private javax.swing.JButton btnAddGrado2;
    private javax.swing.JButton btnAddGrado3;
    private javax.swing.JButton btnAddMadre;
    private javax.swing.JButton btnAddPadre;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnGuardar;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JComboBox cbGrado;
    private javax.swing.JComboBox cbMadre;
    private javax.swing.JComboBox cbPadre;
    private com.toedter.calendar.JDateChooser jDateFechaNac;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JPanel panelEditar;
    private javax.swing.JPanel panelTabla;
    private javax.swing.JTextField tfCarnet;
    private javax.swing.JTextField tfColegiatura;
    private javax.swing.JTextField tfDireccion;
    private javax.swing.JTextField tfEmail;
    private javax.swing.JTextField tfIngles;
    private javax.swing.JTextField tfIntecap;
    private javax.swing.JTextField tfNombre;
    private javax.swing.JTextArea tfObservaciones;
    private javax.swing.JTextField tfTelefonoCasa;
    private javax.swing.JTextField tfTelefonoEmergencia;
    private javax.swing.JTextField tfTelefonoMadre;
    private javax.swing.JTextField tfTelefonoOtro;
    private javax.swing.JTextField tfTelefonosPadre;
    // End of variables declaration//GEN-END:variables
}
